package com.quickask.entity;

import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created by NaSa on 2015/9/22.
 */
@Entity
@Table(name = "asknow_question_classify", schema = "", catalog = "quickask")
@org.hibernate.annotations.Cache(usage= CacheConcurrencyStrategy.READ_WRITE, region = "com.quickask.entity.AsknowQuestionClassifyEntity")
public class AsknowQuestionClassifyEntity implements Serializable {
    private int classifyId;  //分类id
    private Integer questionId;  //问题id
    private String questionTag; //问题分类标签

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "classifyId", nullable = false, insertable = true, updatable = true)
    public int getClassifyId() {
        return classifyId;
    }

    public void setClassifyId(int classifyId) {
        this.classifyId = classifyId;
    }


    @Basic
    @Column(name = "questionId", nullable = false, insertable = true, updatable = true)
    public Integer getQuestionId() {
        return questionId;
    }

    public void setQuestionId(Integer questionId) {
        this.questionId = questionId;
    }

    @Basic
    @Column(name = "questionTag", nullable = true, insertable = true, updatable = true, length = 20)
    public String getQuestionTag() {
        return questionTag;
    }

    public void setQuestionTag(String questionTag) {
        this.questionTag = questionTag;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof AsknowQuestionClassifyEntity)) return false;

        AsknowQuestionClassifyEntity that = (AsknowQuestionClassifyEntity) o;

        if (classifyId != that.classifyId) return false;
        if (questionId != null ? !questionId.equals(that.questionId) : that.questionId != null) return false;
        return !(questionTag != null ? !questionTag.equals(that.questionTag) : that.questionTag != null);

    }

    @Override
    public int hashCode() {
        int result = classifyId;
        result = 31 * result + (questionId != null ? questionId.hashCode() : 0);
        result = 31 * result + (questionTag != null ? questionTag.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "AsknowQuestionClassifyEntity{" +
                "classifyId=" + classifyId +
                ", questionId=" + questionId +
                ", questionTag='" + questionTag + '\'' +
                '}';
    }
}
